package com.exercise.proxytest;

import com.fun.frame.SourceCode;
import net.sf.cglib.proxy.Enhancer;

public class AutoProxy extends SourceCode {

    public static void main(String[] args) {
//        IUserProvider userProvider = new UserProviderImpl();
//        IUserProvider provider = (IUserProvider) Proxy.newProxyInstance(IUserProvider.class.getClassLoader(), new Class[]{IUserProvider.class}, new AutoLogProxy(userProvider));
//        provider.getUser(10);
        CUserProxy proxy = new CUserProxy();
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(CUser.class);
        enhancer.setCallback(proxy);
        CUser user = (CUser) enhancer.create();
        user.fun();
    }


}
